
from django.urls import path, include
from rest_framework import routers
from rest_framework.documentation import include_docs_urls
from appBackend.controllers import LPRController
from appBackend.controllers.CurrencyExchangeRateController import CurrencyExchangeRateRecordsViewSet
from appBackend.controllers.LPRController import LPRRecordsViewSet
from appBackend.controllers.WallPaperController import WallPaperViewSet
from appBackend.controllers import CurrencyExchangeRateController
from appBackend.controllers import WallPaperController
from siliTech import settings

import appBackend.views as views

router = routers.SimpleRouter()
router.register('LPRRecords', LPRRecordsViewSet)
router.register("CurrencyExchangeRateRecords", CurrencyExchangeRateRecordsViewSet)
router.register("WallPaper", WallPaperViewSet)

urlpatterns = [
    path("appBackend/getNewestLPR", LPRController.get_newest_lpr),
    path("appBackend/admin/uploadImage", views.upload_image),
    path("appBackend/getNewestCurrencyExchangeRage", CurrencyExchangeRateController.get_newest_currency_exchange_rate),
    path("appBackend/api/", include(router.urls)),
    path("appBackend/api/getWallPaperOriginal", WallPaperController.get_image_original),
    path("appBackend/api/getWallPaperThumb", WallPaperController.get_image_thumb),
    path("appBackend/api/getMostBeautifulPlace", WallPaperController.get_most_beautiful_place),
    path("appBackend/api/getRecentlyWallpaper", WallPaperController.get_recently_wallpaper),

]

if settings.DEBUG:
    # debug模式下将文档url加入进去
    urlpatterns.append(path('appBackend/docs/', include_docs_urls(title='appBackend apis')),)

